package net.asgarli.ivault.api;

import java.io.IOException;
import java.io.Serializable;

/**
 * Represents the object that is serializable into byte array by iVault custom format.
 * 
 * @author Elchin Asgarli
 * @version 0.1
 * @since 0.1
 */
public interface IVSerializable extends Serializable {

	/**
	 * Saves the state of current object into byte array.
	 * @return the byte array representation of given object.
	 */
	public byte[] saveToByteArray() throws IOException;
	
	/**
	 * Reads the state of object from byte array.
	 * @param bytes
	 */
	public void restoreFromByteArray(byte[] bytes) throws IOException;
}
